﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ProgramCat.EPlug;

namespace ProgramCat.FiddlerExtension.EPlugControl
{
    public partial class EPlugControl : UserControl
    {
        public EPlugControl()
        {
            InitializeComponent();
        }

        public void InitPlug()
        {
            List<EPlugInfo> ePlugs = PlugCoreMgr.Instance.Init();
            foreach (EPlugInfo item in ePlugs)
            {
                ListViewItem listViewItem = new ListViewItem(new string[] {
                    "",
                    item.plugName,
                    item.plugAuthor,
                    item.version,
                    item.successNumber.ToString()
                });
                listViewItem.Tag = item.plugPtr;
                listView_ePlug.Items.Add(listViewItem);
            }
            
        }

        private void listView_ePlug_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            PlugCoreMgr.Instance.SetPlugOpen((int)e.Item.Tag, e.Item.Checked);
        }
    }
}
